package com.example.house.adapter

import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.example.house.R
import com.example.house.entity.HouseEntityItem
import com.example.house.entity.HouseFirstBean


class HouseFirstAdapter: BaseQuickAdapter<HouseFirstBean, BaseViewHolder>(R.layout.item_first_house){
    override fun convert(holder: BaseViewHolder, item: HouseFirstBean) {
       holder.setText(R.id.f_name,item.name)
        val recyclerView = holder.getView<RecyclerView>(R.id.f_rv)
        val houseManngerAdapter=HouseManngerAdapter()
        recyclerView.layoutManager= LinearLayoutManager(context)
        recyclerView.adapter=houseManngerAdapter
        houseManngerAdapter.data.clear()
        houseManngerAdapter.addData(item.list)
    }

}

class HouseManngerAdapter: BaseQuickAdapter<HouseEntityItem, BaseViewHolder>(R.layout.item_home_mannger)  {
    override fun convert(holder: BaseViewHolder, item: HouseEntityItem) {
        holder.setText(R.id.enterpriseName,item.enterpriseName)
        holder.setText(R.id.regionName,item.regionName)
    }
}